import {
	defineStore
} from "pinia";

import {
	computed,
	onMounted,
	onUnmounted,
	reactive,
	ref,
	nextTick,
	toRaw,
	watch,
} from "vue";

import * as util from '@/amtf/utils'
// import { uid } from 'quasar'
// import { date } from 'quasar'
import useApi from "@/api/增查api.js"

export default defineStore("设置",
	() => {
		const api = useApi({ key: "设置" })
		const { 清缓存 } = api
		const a = reactive({
			每小时台球费: 58,
			最小计费分钟数: 20,
			单位候选值组: ['瓶', '包', '个'],
			客户组: ['a666', 'a888', 'a999'],
		})

		async function 初始化() {
			const res = await api.查()
			Object.assign(a, res)
		}
		初始化()

		watch(a, () => {
				// console.log("变化了");
				api.改整个对象(a)
			}

		)

		return {
			a,
			清缓存,
		};

	}

);